package com.tuanzi.loan.web.lazy.family;

import com.tuanzi.loan.business.service.family.SwitchService;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.SwitchListSearchRequest;
import com.tuanzi.loan.vo.request.family.SwitchRank;
import com.tuanzi.loan.vo.response.family.SwitchListSearchResponse;
import com.tuanzi.loan.web.bean.CurrentUserBean;
import com.tuanzi.loan.web.lazy.LazyDataSessionModel;
import org.springframework.data.domain.Page;

import java.util.HashMap;

public class SwitchListLazyDataModel extends LazyDataSessionModel<SwitchListSearchRequest, SwitchListSearchResponse> {

	private SwitchService switchService;
	HashMap<String, SwitchRank> switchRankMap;

	public SwitchListLazyDataModel(SwitchListSearchRequest switchListSearchRequest, CurrentUserBean session, HashMap<String, SwitchRank> switchRankMap, SwitchService switchService) {
		super(switchListSearchRequest, session);
		this.switchRankMap = switchRankMap;
		this.switchService = switchService;
	}

	@Override
	protected Page<SwitchListSearchResponse> doLoad0(PageSearcher<SwitchListSearchRequest> pageSearcher) {
		return switchService.list(pageSearcher, switchRankMap);
	}
}

